import 'package:cook_dinner/pages/cart/cart_view/cart_view.dart';
import 'package:cook_dinner/widgets/custom_appbar.dart';
import 'package:flutter/material.dart';
import 'package:cook_dinner/config/include.dart';

const List<String> meet = ['五花肉', '羊肉', '牛肉', '鸡肉', '鸭肉', '鱼肉'];

class CartPage extends StatefulWidget {
  const CartPage({Key? key}) : super(key: key);

  @override
  State<CartPage> createState() => _CartPageState();
}

class _CartPageState extends State<CartPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: const Color(0xfff9f9f9),
      appBar: AppBarCustom('购物车'),
      body: ListView.builder(
        padding: EdgeInsets.only(
          top: 34.rpx,
          left: 27.rpx,
          right: 27.rpx,
          bottom: 34.rpx,
        ),
        itemCount: meet.length,
        itemBuilder: (context, index) {
          return CartItem(
            title: meet[index],
          );
        },
      ),
      bottomNavigationBar: Container(
        width: HYSizeFit.screenWidth,
        height: 138.rpx,
        padding: EdgeInsets.only(
          top: 23.rpx,
          right: 29.rpx,
          left: 21.rpx,
          bottom: 21.rpx + HYSizeFit.bottomHeight,
        ),
        decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.only(
            topLeft: Radius.circular(20.rpx),
            topRight: Radius.circular(20.rpx),
          ),
          boxShadow: [
            BoxShadow(
              offset: Offset(0, -3.rpx), // 垂直偏移4px，水平偏移0
              blurRadius: 4.rpx, // 模糊半径20px
              spreadRadius: 0, // 扩展半径0，保持阴影大小不变
              color: const Color(0xFF000000).withOpacity(0.15), // 颜色设置为透明度较低的黑色
            ),
          ],
        ),
        child: Column(
          children: [
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Text(
                  '共计：1件',
                  style: TextStyle(color: Colors.black, fontSize: 14.rpx),
                ),
                Text(
                  '合计：700元',
                  style: TextStyle(color: Colors.black, fontSize: 14.rpx),
                ),
              ],
            ),
            InkWell(
              child: Container(
                width: 335.rpx,
                height: 58.rpx,
                alignment: Alignment.center,
                margin: EdgeInsets.only(top: 14.rpx),
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(20.rpx),
                  color: const Color(0xffFCC302),
                ),
                child: Text(
                  '支付',
                  style: TextStyle(color: Colors.white, fontSize: 20.rpx),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
